﻿using System;
namespace Producers.Arireg.Xtee.Riik.Ee.Producer.Arireg {
    
    
    public partial class Payment : global::Producers.Arireg.Xtee.Riik.Ee.Producer.Arireg.IPayment {
        
        private Payment.TypeType @__type;
        
        private Payment.BaseCurrencyAmountType @__baseCurrencyAmount;
        
        private Payment.AmountType @__amount;
        
        private Payment.CurrencyType @__currency;
        
        public Payment() {
        }
        
        /// <summary>
        /// All parameters
        /// </summary>
        public Payment(Payment.TypeType @type, Payment.BaseCurrencyAmountType @baseCurrencyAmount, Payment.AmountType @amount, Payment.CurrencyType @currency) {
            this.@__type = @type;
            this.@__baseCurrencyAmount = @baseCurrencyAmount;
            this.@__amount = @amount;
            this.@__currency = @currency;
        }
        
        /// <summary>
        /// Copy Constructor
        /// </summary>
        protected Payment(IPayment @payment) {
            this.@__type = @payment.Type;
            this.@__baseCurrencyAmount = @payment.BaseCurrencyAmount;
            this.@__amount = @payment.Amount;
            this.@__currency = @payment.Currency;
        }
        
        public virtual Payment.TypeType Type {
            get {
                return this.@__type;
            }
            set {
                this.@__type = value;
            }
        }
        
        public virtual Payment.BaseCurrencyAmountType BaseCurrencyAmount {
            get {
                return this.@__baseCurrencyAmount;
            }
            set {
                this.@__baseCurrencyAmount = value;
            }
        }
        
        public virtual Payment.AmountType Amount {
            get {
                return this.@__amount;
            }
            set {
                this.@__amount = value;
            }
        }
        
        public virtual Payment.CurrencyType Currency {
            get {
                return this.@__currency;
            }
            set {
                this.@__currency = value;
            }
        }
        
        public class TypeType : global::Xtee.Core.Schema.XsdString {
            
            public const string C = "C";
            
            public const string D = "D";
            
            public TypeType(string value) : 
                    base(value) {
                this.PikkusVordne = 1;
                this.Validate();
                string annot = null;
                if (Value == "C") {
                    annot = "C";
                }
                if (Value == "D") {
                    annot = "D";
                }
                if (annot!=null) {
                    this._annotation = annot;
                }
                else {
                    throw new global::Xtee.Core.Types.XteeSimpleTypeValidationException(string.Format("Enumeration on [{0}] does not allow value : [{1}] ", this.GetType().Name,Value.ToString()));;
                }
            }
            
            public TypeType() : 
                    base(string.Empty) {
            }
            
            public static bool TryParse(string value, out TypeType result) {
                try {
                    result = new TypeType(value);
                    return true;
                }
                catch (System.Exception ) {
                    result = null;
                    return false;
                }
            }
            
            public static implicit operator String (TypeType value) {
                return value.Value;
            }
            
            public static implicit operator TypeType (string value) {
                if (value==null) {
                    return null;
                }
                return new TypeType(value);
            }
        }
        
        public class BaseCurrencyAmountType : global::Xtee.Core.Schema.XsdDecimal {
            
            public BaseCurrencyAmountType(decimal value) : 
                    base(value) {
                this.KohtadeArvVõrdne = 15;
                this.Komakohti = 2;
                this.Validate();
            }
            
            public BaseCurrencyAmountType(string value) : 
                    base(value) {
                this.KohtadeArvVõrdne = 15;
                this.Komakohti = 2;
                this.Validate();
            }
            
            public BaseCurrencyAmountType() : 
                    base(new decimal()) {
            }
            
            public static bool TryParse(string value, out BaseCurrencyAmountType result) {
                try {
                    result = new BaseCurrencyAmountType(value);
                    return true;
                }
                catch (System.Exception ) {
                    result = null;
                    return false;
                }
            }
            
            public static implicit operator Decimal (BaseCurrencyAmountType value) {
                return value.Value;
            }
            
            public static implicit operator BaseCurrencyAmountType (decimal value) {
                return new BaseCurrencyAmountType(value);
            }
        }
        
        public class AmountType : global::Xtee.Core.Schema.XsdDecimal {
            
            public AmountType(decimal value) : 
                    base(value) {
                this.KohtadeArvVõrdne = 15;
                this.Komakohti = 2;
                this.Validate();
            }
            
            public AmountType(string value) : 
                    base(value) {
                this.KohtadeArvVõrdne = 15;
                this.Komakohti = 2;
                this.Validate();
            }
            
            public AmountType() : 
                    base(new decimal()) {
            }
            
            public static bool TryParse(string value, out AmountType result) {
                try {
                    result = new AmountType(value);
                    return true;
                }
                catch (System.Exception ) {
                    result = null;
                    return false;
                }
            }
            
            public static implicit operator Decimal (AmountType value) {
                return value.Value;
            }
            
            public static implicit operator AmountType (decimal value) {
                return new AmountType(value);
            }
        }
        
        public class CurrencyType : global::Xtee.Core.Schema.XsdString {
            
            public CurrencyType(string value) : 
                    base(value) {
                this.PikkusVordne = 3;
                this.Pattern = @"[A-Z]{3}";
                this.Pattern = @"[a-z]{3}";
                this.Validate();
            }
            
            public CurrencyType() : 
                    base(string.Empty) {
            }
            
            public static bool TryParse(string value, out CurrencyType result) {
                try {
                    result = new CurrencyType(value);
                    return true;
                }
                catch (System.Exception ) {
                    result = null;
                    return false;
                }
            }
            
            public static implicit operator String (CurrencyType value) {
                return value.Value;
            }
            
            public static implicit operator CurrencyType (string value) {
                if (value==null) {
                    return null;
                }
                return new CurrencyType(value);
            }
        }
    }
}
